<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/base/jsp/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title></title>
	<%@ include file="/base/jsp/jscss.jsp"%>
	<script type="text/javascript">
// 	var products = [
// 	    		    {productid:'FI-SW-01',name:'Koi',ck:"1"},
// 	    		    {productid:'AV-CB-01',name:'Amazon Parrot'}
// 	    		];
	
		$(function () {
			
			$('#dataList').datagrid({  

			    title:'数据库表数据',

// 			    pagination:true,
			    rownumbers:true,
// 			    singleSelect:true,
			    fitColumns: true,
			    striped: true,
// 			    idField:'code',
			    toolbar:easyUi.initButton([{name:'info'}]),
			    frozenColumns:[[
				                {field:'id',checkbox:true}
							]],
			    columns:[[  
			            
		                {field:'name',title:'表名',width:100}, 
		                {field:'info',title:'信息',width:100}
		            ]],
		         
			});
			//${listData}
			$('#dataList').datagrid('loadData', ${listData});
		});
		
		
		function editfun  () {
// 			alert("editfun ");
// 			var selected = $('#dataList').datagrid('getSelected');
// 			alert(selected.ck+":"+selected.name);

		}
		
		function info() {
			var selected = $('#dataList').datagrid('getSelected');
// 			alert(selected.id+":"+selected.name);
			
			initCol (selected.name);
		}
		
		var s = 
		[{"defaultValue":"","info":"","isNull":"N","length":"128","name":"NAME_","type":"NVARCHAR2"},{"defaultValue":"","info":"","isNull":"Y","length":"600","name":"VALUE_","type":"NVARCHAR2"},{"defaultValue":"","info":"","isNull":"Y","length":"22","name":"REV_","type":"NUMBER"}]
;
		function initCol (tablename) {
			$('#columnList').datagrid({  
				url:"${ctx}/database/database!tableInfo.do?tablename="+tablename,
// 				rownumbers:true,
// 				fitColumns: true,
// 				striped: true,
// 				frozenColumns:[[
// 				                {field:'name',checkbox:true}
// 							]],
				columns:[[  
				            
			                {field:'name',title:'字段名',width:100}, 
// 			                {field:'type',title:'类型',width:100}, 
// 			                {field:'info',title:'备注',width:100}, 
// 			                {field:'length',title:'长度',width:100}, 
// 			                {field:'isNull',title:'为空',width:100}, 
// 			                {field:'defaultValue',title:'默认值',width:100}, 
			                
			            ]],
				
				
			});
// 			$('#columnList').datagrid('loadData', s);
		}
		
	</script>
	
</head>
<body>


<div id="dataList"></div>

<div id="columnList"> 
</div>

<!-- <div id="tableInfo"> -->
<!-- 	<div id="dataInfo"></div> -->
<!-- </div> -->

</body>
</html>